'''
v1.01 2018-01-30 20:38:46 Create Project.
'''

import os
import time

FileList = "";
while(1):
    time.sleep(0.3)
    
    #get file path
    DocPath = input("请输入文件夹名称:")
    
    #exit
    if(DocPath == "exit"):
        break
    
    #get file list
    try:
        #FileList = os.listdir(os.getcwd())
        FileList = os.listdir(DocPath)
    except Exception as ex:
        print(ex)
        continue
    
    #check file number
    if(len(FileList) <= 0):
        print("该文件夹下没有文件,请重新输入")
        continue
    
    #create new docs
    DocNewPath = DocPath + "_" + time.strftime("%Y%m%d%H%M%S", time.gmtime())
    os.makedirs(DocNewPath)
    
    #loop
    for count in range(0,len(FileList)):
        #get every file name
        SrcFileName = DocPath + "\\" + str(FileList[count])
        DesFileName = DocNewPath + "\\" + str(FileList[count])
        #print(DocPath + "\\" + str(FileList[count]))
        #print(DocNewPath + "\\" + str(FileList[count]))

        try:
            #open file by read
            fread = open(SrcFileName,"r")
            #read string from file
            strData = fread.read()
            #close file
            fread.close()
        
            #replace all numbers
            #??????
            strData = strData.replace("0","").replace("1","").replace("2","").replace("3","").replace("4","").replace("5","").replace("6","").replace("7","").replace("8","").replace("9","")
    
            #open new file by write
            fwrite = open(DesFileName,"w")
            #write new file
            fwrite.write(strData)
            #close new file
            fwrite.close()
        except Exception as ex:
            print(ex)
            continue
        
    print("文件处理完成")
